#ifndef _SPRITE_SHEET_H_
#define _SPRITE_SHEET_H_

#include "SDL.h"
#include "sprite.h"
#include <string>

#define SPRITE_SHEET_BORDER_WIDTH 2

class SpriteSheet;
typedef void (*AnimationCallback)(void* obj, SpriteSheet* sprite);

class SpriteSheet : public Sprite
{
protected:
	double life;
	double animationSpan;
	double animationRate;
public:
	SpriteSheet(std::string imageName, bool alphaFormat, int numFrames);
	void Update(double timeDelta);
    void Render(SDL_Surface* screen);
	void AdvanceFrame();
	Sint16 frame, numberFrames;
	Uint16 frameOffset;
	bool animated;
	void setAnimationSpan(double span);
	double getAnimationSpan();
	void setResource(std::string imageName, bool alphaFormat, int numFrames);
	void getScreenCoords(Sint16 &x, Sint16 &y);
	PD_vect2 getFrameSize();
	AnimationCallback OnAnimationCallback;
	void *AnimationCallbackObject;

	//void setAnimationRate(double rate);
	//double getAnimationRate();
};

#endif